package org.jeecg.modules.demo.crm.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.demo.crm.entity.CQuotation;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
 * @Description: 工程报价单
 * @Author: jeecg-boot
 * @Date:   2025-08-28
 * @Version: V1.0
 */
public interface CQuotationMapper extends BaseMapper<CQuotation> {

    @Select("select count(*) from c_quotation where additional_id = #{additionalId}")
    Integer quotationById(@Param("additionalId") String additionalId);

    /**
     * 查询已经关联 工程报价的数据id
     * @return
     */
    @Select("select t1.id  from c_additional_request as t1 LEFT JOIN c_quotation as t2 on t1.id = t2.additional_id  where not t2.id is null")
    List<String> additionalRelatedQuotation();

    /**
     * 查询未关联 工程报价的数据id
     * @return
     */
    @Select("select t1.id  from c_additional_request as t1 LEFT JOIN c_quotation as t2 on t1.id = t2.additional_id  where  t2.id is null")
    List<String> additionalNotRelatedQuotation();
}
